﻿using System;
using System.Data.Services.Common;

namespace NCS.IConnect.Cloud.Core
{
    /// <summary>
    /// Table Service Entity Base, which is identity with Microsoft.WindowsAzure.StorageClient.TableServiceEntity, 
    /// just decouple dependency from Microsoft.WindowsAzure.StorageClient.dll
    /// </summary>
    [DataServiceKey(new[] { "PartitionKey", "RowKey" }), CLSCompliant(false)]
    public abstract class TableServiceEntityBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="TableServiceEntityBase"/> class.
        /// </summary>
        protected TableServiceEntityBase()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="TableServiceEntityBase"/> class.
        /// </summary>
        /// <param name="partitionKey">The partition key.</param>
        /// <param name="rowKey">The row key.</param>
        protected TableServiceEntityBase(string partitionKey, string rowKey)
        {
            PartitionKey = partitionKey;
            RowKey = rowKey;
        }

        /// <summary>
        /// Gets or sets the partition key.
        /// </summary>
        /// <value>
        /// The partition key.
        /// </value>
        public virtual String PartitionKey { get; set; }

        /// <summary>
        /// Gets or sets the row key.
        /// </summary>
        /// <value>
        /// The row key.
        /// </value>
        public virtual String RowKey { get; set; }

        /// <summary>
        /// Gets or sets the timestamp.
        /// </summary>
        /// <value>
        /// The timestamp.
        /// </value>
        public DateTime Timestamp { get; set; }
    }
}
